﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="frmCRUDMaterial.aspx.cs" Inherits="SISLOG.Web.frmCRUDMaterial" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<fieldset>
   <legend><asp:Label id="LabelTitulo" runat="server"></asp:Label></legend>
        <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1" 
            DefaultMode="Edit" oniteminserted="FormView1_ItemInserted" 
            onitemupdated="FormView1_ItemUpdated">
            <EditItemTemplate>
                <table class="style1">
                    <tr>
                        <td>
                            Id Material:</td>
                        <td>
                            <asp:TextBox ID="idMaterialTextBox" runat="server" Height="20px" 
                                Text='<%# Bind("idMaterial") %>' Width="160px" Enabled="False" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Descripcion:</td>
                        <td>
                            <asp:TextBox ID="descripcionTextBox" runat="server" 
                                Text='<%# Bind("descripcion") %>' Width="160px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Proveedor:</td>
                        <td>
                            <asp:DropDownList ID="DropDownList1" runat="server" 
                                DataSourceID="ObjectDataSource1" DataTextField="nombreEmpresa" 
                                DataValueField="idProveedor" SelectedValue='<%# Bind("idProveedor") %>' 
                                Width="160px">
                            </asp:DropDownList>
                            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                                onobjectcreating="ObjectDataSource1_ObjectCreating1" 
                                SelectMethod="GetAllFromProveedor" TypeName="SISLOG.BusinessLogic.ProveedorBL">
                            </asp:ObjectDataSource>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Fecha Ingreso:</td>
                        <td>
                            <asp:TextBox ID="fechaIngresoTextBox" runat="server" 
                                Text='<%# Bind("fechaIngreso") %>' Width="160px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Stock Inicial:</td>
                        <td>
                            <asp:TextBox ID="stockInicialTextBox" runat="server" 
                                Text='<%# Bind("stockInicial") %>' Width="160px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Stock Final:</td>
                        <td>
                            <asp:TextBox ID="stockFinalTextBox" runat="server" 
                                Text='<%# Bind("stockFinal") %>' Width="160px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Punto Reorden:</td>
                        <td>
                            <asp:TextBox ID="puntoReordenTextBox" runat="server" 
                                Text='<%# Bind("puntoReorden") %>' Width="160px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;</td>
                        <td>
                           <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                                CommandName="Update" Text="Actualizar" />
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                CommandName="Cancel" Text="Cancelar" PostBackUrl="~/frmMaterial.aspx" />
                        </td>
                    </tr>
                </table>  
            </EditItemTemplate>
            <InsertItemTemplate>
                <table class="style1">
                    <tr>
                        <td>
                            Id Material:</td>
                        <td>
                            <asp:TextBox ID="idMaterialTextBox" runat="server" Height="20px" 
                                Text='0' Width="160px" Enabled="False" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Descripcion:</td>
                        <td>
                            <asp:TextBox ID="descripcionTextBox" runat="server" 
                                Text='<%# Bind("descripcion") %>' Width="160px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Proveedor:</td>
                        <td>
                            <asp:DropDownList ID="DropDownList1" runat="server" 
                                DataSourceID="ObjectDataSource1" DataTextField="nombreEmpresa" 
                                DataValueField="idProveedor" SelectedValue='<%# Bind("idProveedor") %>' 
                                Width="160px">
                            </asp:DropDownList>
                            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                                onobjectcreating="ObjectDataSource1_ObjectCreating1" 
                                SelectMethod="GetAllFromProveedor" TypeName="SISLOG.BusinessLogic.ProveedorBL">
                            </asp:ObjectDataSource>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Fecha Ingreso:</td>
                        <td>

                            <asp:TextBox ID="fechaIngresoTextBox" runat="server" 
                                Text='<%# Bind("fechaIngreso") %>' Width="160px" />                       
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Stock Inicial:</td>
                        <td>
                            <asp:TextBox ID="stockInicialTextBox" runat="server" 
                                Text='<%# Bind("stockInicial") %>' Width="160px" />
                        </td>
                    </tr>
                    <%--<tr>
                        <td>
                            Stock Final:</td>
                        <td>
                            <asp:TextBox ID="stockFinalTextBox" runat="server" 
                                Text='<%# Bind("stockFinal") %>' Width="160px" />
                        </td>
                    </tr>--%>
                    <tr>
                        <td>
                            Punto Reorden:</td>
                        <td>
                            <asp:TextBox ID="puntoReordenTextBox" runat="server" 
                                Text='<%# Bind("puntoReorden") %>' Width="160px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;</td>
                        <td>
                           <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insertar" />
                           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" 
                                PostBackUrl="~/frmMaterial.aspx" />
                        </td>
                    </tr>
                </table>                
            </InsertItemTemplate>
            <ItemTemplate>
                idMaterial:
                <asp:Label ID="idMaterialLabel" runat="server" 
                    Text='<%# Bind("idMaterial") %>' />
                <br />
                descripcion:
                <asp:Label ID="descripcionLabel" runat="server" 
                    Text='<%# Bind("descripcion") %>' />
                <br />
                idProveedor:
                <asp:Label ID="idProveedorLabel" runat="server" 
                    Text='<%# Bind("idProveedor") %>' />
                <br />
                fechaIngreso:
                <asp:Label ID="fechaIngresoLabel" runat="server" 
                    Text='<%# Bind("fechaIngreso") %>' />
                <br />
                stockInicial:
                <asp:Label ID="stockInicialLabel" runat="server" 
                    Text='<%# Bind("stockInicial") %>' />
                <br />
                stockFinal:
                <asp:Label ID="stockFinalLabel" runat="server" 
                    Text='<%# Bind("stockFinal") %>' />
                <br />
                puntoReorden:
                <asp:Label ID="puntoReordenLabel" runat="server" 
                    Text='<%# Bind("puntoReorden") %>' />
                <br />
                Proveedor:
                <asp:Label ID="ProveedorLabel" runat="server" Text='<%# Bind("Proveedor") %>' />
                <br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Editar" />
                &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                    CommandName="New" Text="Nuevo" />
            </ItemTemplate>
        </asp:FormView>
   </fieldset>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            DataObjectTypeName="SISLOG.BusinessEntities.Material" 
            InsertMethod="RegistrarMaterial" 
            onobjectcreating="ObjectDataSource1_ObjectCreating" 
            SelectMethod="GetAllFromMaterialByIdMaterial" 
            TypeName="SISLOG.BusinessLogic.MaterialBL" UpdateMethod="RegistrarMaterial">
            <SelectParameters>
                <asp:QueryStringParameter Name="idMaterial" QueryStringField="id" 
                    Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
</asp:Content>
